#ifndef _OPERATOR_COST_H_
#define _OPERATOR_COST_H_

#include <vector>

#include "Array.h"

class Cost
{
protected:
	Array *array;
public:
	Cost(Array *array);
	virtual ~Cost();

	virtual double getCost() = 0;

	void setArray(Array *array);
};

class OperatorCost : public Cost
{
private:
	//double time;
	double coefficient;

	double calcTime();
public:
	OperatorCost(double time = 0, double coefficient = 1, Array *array = 0);
	OperatorCost(Array *array);
	//OperatorCost(const OperatorCost &cost);
	~OperatorCost();

	virtual double getCost();
	Array *getArray();
	double getCost(double count);
	double getCount();
	double applyCoefficient(double count);
};

struct CostInfo
{
	Array *arr;
	double cost;
	double count;

	CostInfo(double cost, double count);
};

void queryCost(struct Query *q, CostInfo *ci);

#endif